
<template>

    <div class="group-list">
        <div class="head">
            <h2>教师推荐</h2>
            <!-- <el-button round>查看更多+</el-button> -->
        </div>
        
        <ul>
           <li v-for="item in teaList" :key="item.id">
               <div class="group">
                <div class="left">
                    <img :src="item.avatar"/>
                    
                </div>
                <div class="right">
                    <div class="top">
                        <span>{{item.name}}</span>
                    </div>
                    <div class="bottom">
                        <!-- <span>222人</span> -->
                         <button class="jiaru">
                            <RouterLink :to="`/teainfo/${item.id}`">
                            更多+
                            </RouterLink>
                            </button>
                    </div>
                </div>
               </div>
            </li>
          
          
        </ul>

    </div>
</template>
<script setup>
import {teacherListAPI} from '@/apis/home'
import { onMounted,ref} from 'vue'

const teaList = ref([])
onMounted(()=>{
    getTeacher()
})
const getTeacher = async()=>{
    const res = await teacherListAPI()
    teaList.value = res.data.list
}
</script>

<style scoped>
.group-list {
    margin-top: 30px;
}
.head {
    display:flex;
    justify-content: space-between;
}
.group-list ul{
    display: flex;
    flex-wrap: wrap;
    margin-top: 10px;
   
}
.group-list li{
    width: 240px;
    height: 120px;
    list-style: none;
    margin-bottom: 30px;
    margin-right: 46px;
    background-color: #fff;
    padding: 10px 10px;
    border-radius: 5px;
}
li:nth-child(4n){
    margin-right: 0;
}
.group {
display: flex;
}
.group .left{
    width: 100px;
    margin-right: 10px;
}
.left img{
    width: 100px;
    height: 100px;
    vertical-align: top;
}
.right{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    
    
}
.top {
    width: 110px;
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
}
.bottom button{
    background-color: rgb(61, 189, 240);
    border: none;
    padding: 3px 3px;
    color:#fff;
    text-align: center;
    margin-left: 5px;
}

</style>
